{layout name="main"/}
<script type="text/javascript" src="/static/js/jquery.citys.js"></script>
<div class="wrapper wrapper-content animated fadeInUp">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox">
                <div class="ibox-title">
                    <h5>修改资料</h5>
                </div>
                <div class="ibox-content">
                    <form method="post" action="" class="form-horizontal m-t" id="editUser">
                      {if $changerec}
                      <div class="form-group">
                          <label class="col-sm-3 control-label">推荐人 * </label>
                          <div class="col-sm-5">
                              <input type="text" class="form-control" value="{$user->parent_user->user_uniid}" name="rec_user_uniid">
                              <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 默认为当前登录账号</span>
                          </div>
                      </div>
                      {else}
                         {if $user.parent_user}
                        <div class="form-group">
                            <label class="col-sm-3 control-label">推荐人 * </label>
                            <div class="col-sm-5">
<!--                                <input type="text" class="form-control" value="3322"  readonly="readonly"  name="title">-->
                                   <label class="text-danger control-label">{$user->parent_user->user_name}</label>

                            </div>
                        </div>
                             <div class="hr-line-dashed"></div>
                         {/if}
                      {/if}
                        <div class="form-group">
                            <label class="col-sm-3 control-label">会员等级 * </label>
                            <div class="col-sm-5">
                                <label class="text-danger control-label">{$user->account_type}</label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">会员编号 * </label>
                            <div class="col-sm-5">

                                   <label class="text-danger control-label">{$user->user_uniid}</label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">会员昵称 * </label>
                            <div class="col-sm-5">
							{if $usertype eq 'admin' or $usertype eq 'superuser'}
								<input type="text" placeholder="请输入会员昵称" class="form-control" name="user_name" value="{$user->user_name}">
							{else}
								<label class="text-danger control-label">{$user->user_name}</label>
							{/if}
                            </div>
                        </div>



                        <div class="hr-line-dashed"></div>


                        <div class="form-group">
                            <label class="col-sm-3 control-label">开户银行 * </label>
                            <div class="col-sm-5">

                                <select class="form-control" id="bank_name" name="bank_name">
                                    <option>请选择</option>

                                    {volist name="banks" id="bank"}
                                      <option{if $bank eq $user->vaild_card->bank_name} selected="selected"{/if}>{$bank}</option>
                                    {/volist}
                                </select>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">银行账号 * </label>
                            <div class="col-sm-5">
                                <input type="text" placeholder="请输入银行账号" class="form-control" name="card_number" value="{$user->vaild_card->card_number}">
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 输入19位正确的银行卡号</span>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">开户姓名 * </label>
                            <div class="col-sm-5">
                                <input type="text" class="form-control" placeholder="请输入开户姓名" name="card_name" value="{$user->vaild_card->card_name}">
                            </div>
                        </div>

                        <div class="form-group" id="khzh"{if condition="$user->vaild_card->bank_name eq '支付宝'"} style="display: none"{/if}>
                            <label class="col-sm-3 control-label">开户支行 * </label>
                            <div class="col-sm-5">
                                <!--                                <input type="text" class="form-control"  placeholder="请输入开户支行如：南昌分行阳明路支行" name="title" value="">-->

                                <div class="input-group m-b citys">
                                    <div class="input-group-btn">
                                        <select class="form-control" name="province" style="width:100px"></select>
                                    </div>
                                    <div class="input-group-btn">
                                    <select class="form-control" name="city" style="width:100px"></select>
                                    </div>
                                    <input type="text" placeholder="请输入开户支行" class="form-control" name="card_sub_bank" value="{$sub_bank}">
                                </div>
                                <script type="text/javascript">
                                    $('.citys').citys({
                                        province: '{$province}',
                                        city: '{$city}'
                                    });
                                </script>




                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">身份证号码 * </label>
                            <div class="col-sm-5">
                                <input type="text" placeholder="请输入您注册的身份证号码" class="form-control" name="id_number" value="{$user->id_number}">
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 输入18位正确的身份证号码</span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">联系电话 * </label>
                            <div class="col-sm-5">
                                <input type="text" placeholder="请输入您的联系电话" class="form-control" name="phone" value="{$user->phone}">
                            </div>
                        </div>
                                <div class="hr-line-dashed"></div>
                          <div class="form-group">
                            <label class="col-sm-3 control-label">注册时间 * </label>
                            <div class="col-sm-5">
                                 <label class=" control-label">{$user->create_time}</label>

                            </div>
                        </div>

                                   {if $user.user_type eq 'user'}
                          <div class="form-group">
                            <label class="col-sm-3 control-label">认证时间 * </label>
                            <div class="col-sm-5">

                                   <label class=" control-label">{$user->confirm_time}</label>

                            </div>
                        </div>
                                      {/if}
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-3">
                                <button class="btn btn-primary" type="button" onclick="edit()">保存修改</button>
                            </div>
                        </div>

                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    function edit() {
        var postdata = $("#editUser").serialize();
        post({
            url: "{$thispageurl}",
            data: postdata,
            success: function(res) {
                swal({
                    title: 'success',
                    text: res.message,
                    type: "success"
                }, function() {
                    reload();
                });
            },
            error: function(error) {
                swal("错误", JSON.parse(error.responseText).message, "error");
            }
        });
    }
    $("#bank_name").change(function(){
       v=$(this).val();
       if(v=="支付宝"){
           $('#khzh').hide();
           return;
       }
       $("#khzh").show();
    })
</script>
